Skip to content

fix: avoid try_clone in net_connect to fix Windows DNS resolution - #69

Merged
danbugs merged 1 commit into
mainfrom
fix/windows-connect-timeout
May 17, 2026
Merged

fix: avoid try_clone in net_connect to fix Windows DNS resolution#69
danbugs merged 1 commit into
mainfrom
fix/windows-connect-timeout

Conversation

@danbugs

@danbugs danbugs commented May 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Removes try_clone() + drop pattern from handle_net_connect, calling connect_timeout directly on the socket while holding the table lock
  • connect_timeout internally toggles non-blocking mode on the socket. When called on a cloned handle (via try_clone/WSADuplicateSocket), dropping the clone after the call appears to leave the original socket in non-blocking mode on Windows. Subsequent recvfrom for DNS queries then returns immediately with EWOULDBLOCK instead of blocking for the response, causing "Temporary failure in name resolution"
  • Holding the lock during connect_timeout is safe because guest dispatch is single-threaded — no other thread contends for the socket table during a call
  • This fixes the runtime-test-windows (networking-py, urllib_get) test that has been consistently failing since the socket timeout changes landed

Test plan

  • cargo test --lib passes (57 tests)
  • cargo clippy clean
  • cargo fmt clean
  • CI: runtime-test-windows (networking-py, urllib_get) should now pass

…orruption

Signed-off-by: danbugs <danilochiarlone@gmail.com>
Copilot AI review requested due to automatic review settings May 17, 2026 08:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates host-proxied networking to avoid cloning sockets during net_connect, addressing Windows DNS resolution failures caused by cloned socket handles leaving the original socket in non-blocking mode.

Changes:

  • Replaces the try_clone() pattern in handle_net_connect with direct use of the socket from the socket table.
  • Holds the socket table lock while calling connect_timeout.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux Benchmarks

Details
Benchmark suite Current: ac8fd6f Previous: 52a28ce Ratio
hello_world (median) 20 ms 20 ms 1
pandas (median) 110 ms 100 ms 1.10
density (per VM) 7 MB 7 MB 1
snapshot (disk) 385 MiB 385 MiB 1

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows Benchmarks

Details
Benchmark suite Current: ac8fd6f Previous: 52a28ce Ratio
hello_world (median) 294 ms 301 ms 0.98
pandas (median) 1030 ms 966 ms 1.07
density (per VM) 6 MB 6 MB 1
snapshot (disk) 392 MiB 392 MiB 1

This comment was automatically generated by workflow using github-action-benchmark.

@danbugs
danbugs merged commit d42ff50 into main May 17, 2026
80 checks passed
@danbugs
danbugs deleted the fix/windows-connect-timeout branch May 17, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants